﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms;

public partial class Form_XoaGioHang : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int maSp = (int)int.Parse(Request.QueryString["MaSP"].ToString());
        XoaHang(maSp);
        Response.Redirect("GioHang.aspx");
    }
    public void XoaHang(int maSP)
    {
        List<NewCart> listNewCart = (List<NewCart>)Session["Cart"];
        var res = from s in listNewCart
                  where s.MaSp == maSP
                  select s;
        if (listNewCart.Count > 0)
        {
            NewCart newC = new NewCart();
            newC = res.FirstOrDefault();
            listNewCart.Remove(newC);
        }
    }
}